﻿from django import newforms as forms
from google.appengine.api import users
import models
from google.appengine.ext.db import djangoforms
from app.functions.funcs import split_tags

class TopicForm(forms.Form):
    title = forms.CharField()
    content = forms.CharField(widget=forms.Textarea())

    def save(self):
        user = users.get_current_user()
        data = models.Topic(title=self.clean_data['title'],
                            content=self.clean_data['content'],
                            author=current_user)
        data.put()
    def edit(self,topic):
        topic.title=self.clean_data['title']
        topic.content=self.clean_data['content']
        topic.put()
